package com.example.exam.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.exam.entity.Notice;
import com.example.exam.mapper.NoticeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zhang
 */
@Service
public class NoticeServiceImpl {
    @Autowired
    private NoticeMapper noticeMapper;

    public Integer addNotice(Notice notice) {
        return noticeMapper.insert(notice);
    }

    public IPage<Notice> getNoticeById() {
        QueryWrapper<Notice> qr = new QueryWrapper<>();
        return noticeMapper.selectPage(new Page<>(1, 5), qr);
    }
}
